// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch;

/// <summary>
/// <para><see href="https://www.elastic.co/docs/reference/elasticsearch/rest-apis/api-conventions#byte-units">Learn more about this API in the Elasticsearch documentation.</see></para>
/// </summary>
[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Json.ByteSizeConverter))]
public sealed partial class ByteSize : Elastic.Clients.Elasticsearch.Union<long, string>
{
	public ByteSize(long value) : base(value)
	{
	}

	public ByteSize(string value) : base(value)
	{
	}

	public static implicit operator Elastic.Clients.Elasticsearch.ByteSize(long value) => new Elastic.Clients.Elasticsearch.ByteSize(value);
	public static implicit operator Elastic.Clients.Elasticsearch.ByteSize(string value) => new Elastic.Clients.Elasticsearch.ByteSize(value);
}

public readonly partial struct ByteSizeFactory
{
	public Elastic.Clients.Elasticsearch.ByteSize Value(long value)
	{
		return new Elastic.Clients.Elasticsearch.ByteSize(value);
	}

	public Elastic.Clients.Elasticsearch.ByteSize Value(string value)
	{
		return new Elastic.Clients.Elasticsearch.ByteSize(value);
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.ByteSize Build(System.Func<Elastic.Clients.Elasticsearch.ByteSizeFactory, Elastic.Clients.Elasticsearch.ByteSize> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.ByteSizeFactory();
		return action.Invoke(builder);
	}
}